package io.renren.modules.job.task;

import io.renren.modules.takeout.service.OrdersService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 自动完成订单任务
 *
 * @author Jerry
 */
@Component("autoCompleteOrderTask")
public class AutoCompleteOrderTask implements ITask {

    private static final Logger logger = LoggerFactory.getLogger(AutoCompleteOrderTask.class);

    @Autowired
    private OrdersService ordersService;

    @Override
    public void run(String params) {
        logger.info("【定时任务】开始执行订单自动完成任务，参数：{}", params);
        int count = ordersService.autoCompleteOrders();
        logger.info("【定时任务】订单自动完成任务执行结束，共更新 {} 条记录", count);
    }
}
